﻿function BtnDialogSmartLookup(s, e) {
    var dialog = $(s.inputElement).parent().parent().parent().parent();
    var url = dialog.attr("url");

    var dialogSelIndex = parent.parent.$("#hiddenDialogSelIndex");
    var dialogIndex = dialogSelIndex.val();
    var targetID = "";
    if (parent.frameElement == undefined) {
        targetID = self.frameElement.id + "." + s.uniqueID.replace("$", "_");
    } else {
        targetID = parent.frameElement.id + "." + self.frameElement.id + "." + s.uniqueID.replace("$", "_");
    }

    eval("parent.parent.dialogSel" + dialogIndex + ".targetID='" + targetID + "'");
    eval("parent.parent.dialogSel" + dialogIndex + ".SetContentUrl('" + url + "')");

    if (url.indexOf("DialogTreeSel.aspx") != -1) {
        eval("parent.parent.dialogSel" + dialogIndex + ".SetSize(300, 500)");
    } else if (url.indexOf("DialogGridSel.aspx") != -1) {
        eval("parent.parent.dialogSel" + dialogIndex + ".SetSize(900, 600)");
    }
    eval("parent.parent.dialogSel" + dialogIndex + ".Show()");
    e.processOnServer = false;
}